home *** CD-ROM | disk | FTP | other *** search
/ Die Speccy' 97 / Die Speccy' 97.iso / amiga_system / the_aminet / util / cli / gengui21.lha / Gengui2.1 / Gengui.doc next >
Text File  |  1995-10-12  |  47KB  |  1,379 lines

  1.  
  2.  
  3.                            GenGui V2.1
  4.                            ===========
  5.  
  6.                     ⌐1994-95 by Matthias Meixner
  7.  
  8.                Read the README file for the legal issues
  9.  
  10.  
  11. This package is for layout and creation of graphical user interfaces (GUI).
  12. Unlike some other programs like Gadtools, you do not draw your GUI just like
  13. in a paint-program, but you describe the GUI in a kind of description
  14. language. From this description GenGui generates a C-headerfile, wich
  15. containes the description data in a form that is needed by the routines
  16. which must be linked to your program and which do the real work on runtime.
  17.  
  18. For the legal issues read the "readme"-file.
  19.  
  20.  
  21. 1. Preface
  22. ==========
  23.  
  24. From version 36 of the Amiga operating system on it is possible to select
  25. the font that should be used. Since there are now several new display-
  26. resolutions it is highly recommended, that applications should be able to
  27. use higher resolutions and therefore it is required, that programs can adapt
  28. to a variable windowsize.
  29. OK, lets face the current situation. There are half a dozen different
  30. systems out there, that all allow to create font-sensitive and resizeable
  31. GUIs. Most of them come with a shared library, that implemets its own
  32. gadgets, and they are all about 100kBytes in size. Since there is no
  33. standard for these tools yet, every programmer uses his preferred generator
  34. and every program uses another shared library. But what's the use of shared-
  35. libraries, if every program uses another one? If you have got three programs
  36. running, that all use a different library, then the libraries allocate
  37. already 300kBytes just for three layout-engines and for many unused button-
  38. types, each implementing their own version of the same types of buttons.
  39. Therefore I wrote Gengui. It uses GadTools-gadgets, which already come with
  40. the operating system and implements a layout-enging for these gadgets. It
  41. does not use a shared-library, but comes as a quite small link-library.
  42.  
  43.  
  44. 2. The basic idea:
  45. ==================
  46.  
  47. The description of the Gui is box oriented. Every box affects the size
  48. and position of the objects inside the box. A box has an orientation, which
  49. determines the positions of the objects in a box, in a vertical box the
  50. first object is on top and all other objects are below this one, in a
  51. horizontal box, the first one is on the most left side. Within a box every
  52. object can have a relative size, a size absolut in characters or a size
  53. absolut in pixels or a mixture of the last two. This object can be a new box,
  54. a gadget or a custom "gadget". This allows an easy generation of resizeable
  55. GUI's.
  56.  
  57. Maybe you should get an example now:
  58.  
  59. Imagine you want to have a GUI, which looks like that:
  60.  
  61.  
  62. +-------------------------+
  63. |                         |
  64. | +-----+ +-----+ +-----+ |
  65. | |Text1| |Text2| |Text3| |
  66. | +-----+ +-----+ +-----+ |
  67. |                         |
  68. |                         |
  69. |                         |
  70. +-------------------------+
  71.  
  72. The description would look like this:
  73.  
  74. PROJECTNAME Project1 // This is the name, which will be used
  75.                      // in the generated source
  76.  
  77. HBOX                 // horizontal box
  78.    VREL 1            // the box has relative height
  79.    HREL 1            // and relative width
  80.    BUTTON            // We want to generate a button
  81.       STDLINE 1      // with a height of one line plus spacing
  82.       HREL 1         // and relative width
  83.       TEXT "Text1"   // "Text1" should be written in it
  84.       ID   1         // and maybe we want to identify it later
  85.    END
  86.    BUTTON
  87.       STDLINE 1
  88.       HREL 1
  89.       TEXT "Text2"
  90.       ID   2
  91.    END
  92.    BUTTON
  93.       STDLINE 1
  94.       HREL 1
  95.       TEXT "Text3"
  96.       ID   3
  97.    END
  98. END
  99.  
  100. This would describe a GUI with three gadgets, each has (including an adequate
  101. spacing) one third of the width of the window, and a height of one line.
  102.  
  103. Gengui offers some reasonable defaultvalues for the different types of
  104. objects, which significantly reduce the size of the description:
  105.  
  106.  
  107. PROJECTNAME Project1
  108. HBOX
  109.    BUTTON
  110.       TEXT "Text1"
  111.       ID   1
  112.    END
  113.    BUTTON
  114.       TEXT "Text2"
  115.       ID   2
  116.    END
  117.    BUTTON
  118.       TEXT "Text3"
  119.       ID   3
  120.    END
  121. END
  122.  
  123.  
  124. Maybe you want the first button to be double as wide as the other two
  125. buttons:
  126.  
  127.  
  128. PROJECTNAME Project1
  129. HBOX
  130.    BUTTON
  131.       HREL 2        // now this button gets 2 parts of the width of this box
  132.       TEXT "Text1"
  133.       ID   1
  134.    END
  135.    BUTTON           // whereas this button gets only one part,
  136.       TEXT "Text2"
  137.       ID   2
  138.    END
  139.    BUTTON           // and this one too
  140.       TEXT "Text3"
  141.       ID   3
  142.    END
  143. END
  144.  
  145.  
  146.  
  147. Now lets think of something like that:
  148.  
  149. +-----------------+
  150. |                 |
  151. | +-------------+ |
  152. | |             | |
  153. | +-------------+ |
  154. |                 |
  155. | +--------+      |
  156. | |        |      |
  157. | +--------+      |
  158. |                 |
  159. | +---+           |
  160. | |   |           |
  161. | +---+           |
  162. |                 |
  163. +-----------------+
  164.  
  165. The first button has three times the size and the second one two times the
  166. size of the last button.
  167.  
  168.  
  169. PROJECTNAME Project1
  170. VBOX                    // Now one button is above the other !
  171.    BUTTON
  172.       HREL 3            // Three thimes the size
  173.       TEXT "Text1"
  174.       ID   1
  175.    END
  176.    BUTTON
  177.       HREL 2            // two times the size of the last button.
  178.       TEXT "Text2"
  179.       ID   2
  180.    END
  181.    BUTTON
  182.       TEXT "Text3"
  183.       ID   3
  184.    END
  185. END
  186.  
  187.  
  188.  
  189. And now a last example for this topic:
  190.  
  191. +---------------+
  192. |               |
  193. |      +------+ |
  194. |      |      | |
  195. |      +------+ |
  196. |               |
  197. | +--+ +------+ |
  198. | |  | |      | |
  199. | |  | |      | |
  200. | |  | |      | |
  201. | |  | |      | |
  202. | +--+ +------+ |
  203. |               |
  204. +---------------+
  205.  
  206. PROJECTNAME Pro2
  207. HBOX
  208.  
  209.    VBOX        // left box
  210.       HREL 1
  211.  
  212.       VBOX     // this creates the empty place in the top left corner
  213.       END
  214.  
  215.       BUTTON
  216.          VREL2
  217.       END
  218.    END
  219.  
  220.    VBOX        // right box
  221.       HREL 2   // of double width
  222.  
  223.       BUTTON
  224.          VREL 1
  225.       END
  226.  
  227.       BUTTON
  228.          VREL 2
  229.       END
  230.    END
  231.  
  232. END
  233.  
  234.  
  235. 3. Installation
  236. ===============
  237.  
  238. Installation is quite easy:
  239.  
  240. copy gengui.h to your include: directory or you will have to add the path
  241. where it can be found to your include-path.
  242.  
  243.  
  244. 4. The description language
  245. ===========================
  246.  
  247. These are the keywords of the description languange. It does not distinguish
  248. between lower- and uppercase. Some keywords have more than one name, since
  249. i could not decide wich one would be more easy to remember :). These other
  250. names can be found in the brackets ().
  251.  
  252. Every command must be on a separate line, comments begin with '//' and mark
  253. the rest of the line as comment.
  254.  
  255. #c_source
  256. #end_source
  257.  
  258.    Everything between these two lines will be directly included in the
  259.    generated output. These keywords must begin on the first column !
  260.  
  261.  
  262. These are the commands that are used to describe the objects of the GUI:
  263.  
  264. BACKFILL Hook: Install a Backfill Hook, that is used for rendering
  265.                the background of this box.
  266.  
  267. BAR
  268.    BAR      : Insert a bar between two objects. The direction depends on
  269.               the containing object. If this is a VBOX, then a horizontal
  270.               bar will be generated, otherwise a vertical bar.
  271.  
  272. BUTTON
  273.    BUTTON   : Normal button, default size HREL 1, STDLINE 1,
  274.               MINHCHAR strlen(Text), MINHPIX 4
  275.  
  276.  
  277. CHECKBOX
  278.    CHECKBOX : Checkbox, default size HCAR 2, VCHAR 1
  279.  
  280.  
  281. CUSTOM
  282.    CUSTOM   : Custom Gadget, default size HREL 1, VREL 1,
  283.               Read also the chapter about custom gadgets !
  284.  
  285. CYCLE
  286.    CYCLE    : Cycle-gadget, default size HREL 1, STDLINE 1
  287.               MINHCHAR max(strlen(Texts in the Cyclegadget)),
  288.               MINHPIX 24
  289.  
  290.  
  291. FRAME
  292.    FRAME RAISED|RECESSED
  293.             : Draw a frame around this Box (VBOX or HBOX).
  294.               It is raised (FRAME RAISED) or recessed (FRAME RECESSED).
  295.  
  296. GFXBUTTON   : Graphical button. It supports two highlight-methods:
  297.               complement and highlight-image. The images are selected within
  298.               this block with the "IMAGE" command. If there is one such
  299.               command, then complement is used, if there are two of them,
  300.               then the second one is used for highlighting.
  301.  
  302.               You can adjust the alignment within its space with the
  303.               following flags:
  304.  
  305.                   Horizontal alignment: GG_Left,GG_HCentered,GG_Right
  306.                   Vertical alignment:  GG_Top,GG_VCentered,GG_Bottom
  307.  
  308.                   default: GG_Left,GG_Top
  309.  
  310.               You can switch off highlighting by the GG_NoHighlight-flag.
  311.  
  312.               The size of the active region of the button, i.e. the region,
  313.               that reacts to mouse-clicks, is determined by the size of
  314.               the first image, unless you use the GG_FullSize flag, which
  315.               tells gengui, that the whole allocated space should be
  316.               active.
  317.  
  318.               NOTE: you need to select a suitable activation for this
  319.               gadget, e.g. with:
  320.  
  321.                 ACTIVATION GACT_RELVERIFY
  322.  
  323.               GFXBUTTON now supports to change the GFLG_SELECTED flag
  324.               during runtime with GG_SetGadgetAttrs(). The tag to
  325.               do that is GA_Disabled and it must be the first tag in the
  326.               taglist.
  327.  
  328.  
  329. HBOX
  330.    HBOX     : horizontal box, default size: HREL 1, VREL 1
  331.  
  332. INTEGER
  333.    INTEGER  : Integer-gadget, default size HREL 1, STDLINE 1
  334.  
  335. LISTVIEW
  336.    LISTVIEW : default size HREL 1, VREL 1
  337.  
  338. MX
  339.    MX       : MX-gadget, default size HREL 1, VREL 1,
  340.               MINVCHAR # of entries, MINVPIX 6
  341.  
  342. NUMBER
  343.    NUMBER   : Number-gadget, default size HREL 1, STDLINE 1
  344.  
  345. PALETTE
  346.    PALETTE  : Palette-gadget, default size HREL 1, VREL 1
  347.  
  348. PLAINTEXT
  349.    PLAINTEXT: Formatted Text, default size HREL 1, STDLINE 1.
  350.               MINHPIX and MINVPIX are set according to the size of the
  351.               text as default.
  352.               Plaintext supports the following format descriptions:
  353.  
  354.                   \n  : Newline
  355.                   %%  : '%'
  356.  
  357.                   %Cx : Set foreground color to x
  358.                         (e.g. %C1 : set color to 1)
  359.                   %cx : Set background color to x
  360.  
  361.                   %B  : Bold on
  362.                   %b  : Bold off
  363.                   %I  : Italics on
  364.                   %i  : Italics off
  365.                   %N  : Normal style (Bold,Italics,Underlined off)
  366.                   %U  : Underlined on
  367.                   %u  : Underlined off
  368.  
  369.               You can adjust the alignment within its space with the following
  370.               flags:
  371.  
  372.                   Horizontal alignment: GG_Left,GG_HCentered,GG_Right
  373.                   Vertical alignment:  GG_Top,GG_VCentered,GG_Bottom
  374.  
  375.                   default: GG_Left,GG_Top
  376.  
  377.               Unlike TEXT this is not a gadtools gadget, but allows easier
  378.               formatting of text, since it allows texts, that use more
  379.               than one color, style or that span more than one line.
  380.  
  381.               See also GfxPrint();
  382.  
  383. SCROLLER
  384.    SCROLLER : Scroller, default size HREL 1, VREL 1
  385.  
  386. SLIDER
  387.    SLIDER   : Slider, default size HREL 1, VREL 1
  388.  
  389. STRING
  390.    STRING   : String-gadget, default size HREL 1, STDLINE 1
  391.  
  392. TEXT
  393.    TEXT     : Text-gadget, default size HREL 1, STDLINE 1
  394.               See also PLAINTEXT
  395.  
  396. VBOX
  397.    VBOX     : vertical box, default size: HREL 1, VREL 1
  398.  
  399.  
  400. Each of these commads defines a block, which must be terminated by "END"
  401.  
  402.  
  403.  
  404. Commands specifying the size of the objects:
  405.  
  406. HCHAR (XCHAR)
  407.    HCHAR chars   : Absolute width of 'chars' characters
  408.  
  409. HPIX (XPIX)
  410.    HPIX pixel    : Absolute width of 'pixel' pixels
  411.  
  412. HREL (XREL)
  413.    HREL size     :  Relative width
  414.  
  415. STDCOL
  416.    STDCOL chars  : Absolute width of 'chars' characters plus 4 pixels space
  417.  
  418. STDLINE
  419.    STDLINE chars : Absolute height of 'chars' characters plus 4 pixels space
  420.  
  421. VCHAR (YCHAR)
  422.    VCHAR chars   : Absolute height of 'chars' characters
  423.  
  424. VPIX (YPIX)
  425.    VPIX pixel    : Absolute height of 'pixel' pixels
  426.  
  427. VREL (YREL)
  428.    VREL size     : Relative height
  429.  
  430. XSPACE
  431.    XSPACE xs     : Set the amount of horizontal space between gadgets to
  432.                    xs pixels, defaults to INTERWIDTH
  433.                    (only allowed within HBOX/VBOX)
  434. YSPACE
  435.    YSPACE ys     : Set the amount of vertical space between gadgets to
  436.                    ys pixels, defaults to INTERHEIGHT
  437.                    (only allowed within HBOX/VBOX)
  438.  
  439.  
  440. Commands specifying the minimal size for relative objects (box or gadget):
  441.  
  442. MINHCHAR (MINXCHAR)
  443.    MINHCHAR chars   : Minimal width of 'chars' characters
  444.  
  445. MINHPIX (MINXPIX)
  446.    MINHPIX pixel    : Minimal width of 'pixel' pixels
  447.  
  448. MINSTDCOL
  449.    MINSTDCOL chars  : Minimal width of 'chars' characters plus 4 pixels space
  450.  
  451. MINSTDLINE
  452.    MINSTDLINE chars : Minimal height of 'chars' characters plus 4 pixels space
  453.  
  454. MINVCHAR (MINYCHAR)
  455.    MINVCHAR chars   : Minimal height of 'chars' characters
  456.  
  457. MINVPIX (MINYPIX)
  458.    MINVPIX pixel    : Minimal height of 'pixel' pixels
  459.  
  460.  
  461.  
  462. Commands that are used to reserve free space next to an object
  463.  
  464. BOTTOMCHARSPACE
  465.    BOTTOMCHARSPACE char: reserves free space in the bottom of the object,
  466.                          that is 'char' characters high
  467. LEFTCHARSPACE
  468.    LEFTCHARSPACE char  : reserves free space left to the object, that is
  469.                          'char' characters wide
  470. RIGHTCHARSPACE
  471.    RIGHTCHARSPACE char : reserves free space right to the object, that is
  472.                          'char' characters wide
  473. TOPCHARSPACE
  474.    TOPCHARSPACE char   : reserves free space in the top of the object,
  475.                          that is 'char' characters high
  476.  
  477.  
  478. BOTTOMPIXSPACE
  479.    BOTTOMPIXSPACE pix: reserves free space in the bottom of the object,
  480.                        that is 'pix' pixels high
  481. LEFTPIXSPACE
  482.    LEFTPIXSPACE pix  : reserves free space left to the object, that is
  483.                        'pix' pixels wide
  484. RIGHTPIXSPACE
  485.    RIGHTPIXSPACE pix : reserves free space right to the object, that is
  486.                        'pix' pixels wide
  487. TOPPIXSPACE
  488.    TOPPIXSPACE pix   : reserves free space in the top of the object,
  489.                        that is 'pix' pixels high
  490.  
  491.  
  492. BOTTOMSTDSPACE
  493.    BOTTOMSTDSPACE char: reserves free space in the bottom of the object,
  494.                         that is 'char' characters plus 4 pixels high
  495. LEFTSTDSPACE
  496.    LEFTSTDSPACE char  : reserves free space left to the object, that is
  497.                         'char' characters plus 4 pixels wide
  498. RIGHTSTDSPACE
  499.    RIGHTSTDSPACE char : reserves free space right to the object, that is
  500.                         'char' characters plus 4 pixels wide
  501. TOPSTDSPACE
  502.    TOPSTDSPACE char   : reserves free space in the top of the object,
  503.                         that is 'char' characters plus 4 pixels high
  504.  
  505.  
  506. These commands specify the minimal width/height for objects with relative
  507. width/height. It does not affect the relative sizes of different objects.
  508. Thus if you have two objects within one box, each having the same relative
  509. width and one of these has a minimal width of 5 chars and the other one
  510. of 6 chars, then the minimal width of the first one will also be 6 chars,
  511. since the relative size says, that the two objects have always the same
  512. width.
  513. The default values used by Gengui for the minimal sizes are often sufficient
  514. enougth, therefore you will not need to use these commands too often.
  515. (At least I hope so :-) )
  516.  
  517.  
  518. Commands for the description of gadget-specific data:
  519.  
  520. ACTIVATION
  521.    ACTIVATION flg: Set the activation-flags for GFXBUTTONS (GACT_...).
  522.                    See also intuition/intuition.h
  523.  
  524. CUSTOM
  525.    CUSTOM func   : Set the custom function for custom-gadgets.
  526.                    NOTE: this is only valid within a custom-object and since
  527.                          it is written the same way as the CUSTOM-object
  528.                          the meaning of CUSTOM only depends on the context.
  529.  
  530. FLAGS
  531.    FLAGS flagset : Set the flags of the gadget (-> ng_Flags)
  532.                    NOTE: it is possible spread the flags to more than one
  533.                          FLAGS command e.g.:
  534.  
  535.                             FLAGS a|b
  536.  
  537.                          would have the same effect as
  538.  
  539.                             FLAGS a
  540.                             FLAGS b
  541.  
  542.  
  543. HOOK
  544.    HOOK function : Set a hook function that is called, when the gadget sends
  545.                    a message. See also the chapter on hook-functions.
  546.  
  547. ID
  548.    ID [label=]id : Set the ID of the gadget (-> ng_GadgetID)
  549.                    NOTE: id must not contain any whitespace characters !
  550.                    The value of the ID must be >=0. If you supply a label,
  551.                    then gengui will generate the following define:
  552.  
  553.                      #define label id
  554.  
  555.                    Furthermore it will use the label for the generation of
  556.                    the Names, that are used to access the Gadgets.
  557.  
  558.  
  559. IMAGE
  560.    IMAGE image   : This sets the image-data for GFXBUTTONs. "image" must
  561.                    point to a "struct Image" variable. You can generate this
  562.                    data using IconEdit when you have set "SRC" in the
  563.                    tooltypes of IconEdit. Then you will find "Save as C..."
  564.                    in the projects menu. Since IconEdit generates some
  565.                    additional information for the icons, you will need to
  566.                    delete this information from the generated sourcecode.
  567.                    You may define up to two images for every GFXBUTTON.
  568.                    If there are two of them, then the second one is used for
  569.                    highlighting.
  570.  
  571. LABELS
  572.    LABELS label1 [,label2 ...]:
  573.                    Generates everything required for labels in MX-BUTTONS
  574.                    and CYCLE-BUTTONS. These are the string arrays and the
  575.                    suitable tags for the taglists.
  576.  
  577. TAGS
  578.    TAGS tags     : Set the tags for a gadget. You need not set TAG_DONE,
  579.                    since this is automatically done. You may use more than
  580.                    one TAGS command per gadget, e.g.
  581.  
  582.                      TAGS a,b
  583.                      TAGS c,d
  584.  
  585.                    would have the same effect as
  586.  
  587.                      TAGS a,b,c,d
  588.  
  589. TEXT
  590.    TEXT string   : Set the text for the gadget (-> ng_GadgetText)
  591.                    If you specify more than one text, then all these texts
  592.                    are concatenated.
  593.  
  594. TEXTATTR
  595.    TEXTATTR textattr : Set ng_TextAttr. By default the standart font of the
  596.                        window is used for the gadgets.
  597.  
  598.  
  599. TEXTID
  600.    TEXTID [label=]id: Text-id for the use with localized GUI's. Note that
  601.                       you also need to link with gengui_lnk_locale.o
  602.                       to activate the support for locale.library.
  603.                       Furthermore you need to define and initialize the
  604.                       variable 'Catalog' with the catalog, that should be
  605.                       used. If Catalog is NULL, or if there is no
  606.                       translation in the catalog, then gengui will use the
  607.                       non-translated texts, that were set with "TEXT".
  608.  
  609.                       IMPORTANT: If you don't select a TEXTID, then "65535"
  610.                                  will be used as ID. Therefore this ID
  611.                                  must not occur in your catalog-file !
  612.  
  613.                       If you supply a label, then gengui will generate the
  614.                       following define:
  615.  
  616.                           #define label id
  617.  
  618.                       See also examples/xarc_locale
  619.  
  620.  
  621. USER
  622.    USER userdata : Set user data. You can access the user data via the
  623.                    macro GetUserData().
  624.                    NOTE: the field ng_UserData is required by GenGui itself,
  625.                          but therefore it has another field reserved for
  626.                          this purpose.
  627.  
  628.  
  629. General note: The parameters of all these commands may be preprocessor
  630.               symbols, in fact they are just passed on to the generated
  631.               source.
  632.  
  633.  
  634. 5. What's generated by GenGui
  635. =============================
  636. GenGui takes the descriptionfile and generates two headerfile. The first
  637. headerfile contains the full data of the descriptionfile and some required
  638. or useful defines. First it contains a struct WinInfo that has the name which
  639. was set using the command projectname. This struct is required for rendering
  640. the GUI to the window, therefore it is the most important structure in the
  641. headerfile. It allocates GadInfo structures, which store the information of
  642. the look of the GUI. To make these accessible for GG_SetLowlevelAttrs()
  643. Gengui generates defines which are used to supersede the generic names of
  644. the structure valiables. The names have the form:
  645.  
  646. 'Projectname'_GadInfo_'GadgetID'
  647.  
  648. 'GadgetID' is the ID, given by the 'ID' command or the label, if given.
  649.  
  650. They identify the variables themselves. Therefore you will need to use the
  651. &-operator to get the address of them for use with GG_SetLowlevelAttrs().
  652.  
  653. Furthermore an array of pointers to gadgets is allocated in the headerfile.
  654. The name of this array has the form:
  655.  
  656. 'Projectname'_Gadgets
  657.  
  658. This array contains the pointers to the gadgets which you require for e.g.
  659. setting new attributes of the gadgets via GG_SetGadgetAttrs(). But note,
  660. that these entries are only valid as long as the GUI is rendered to the
  661. window and that these entries change when the GUI is resized or changed in
  662. other ways. To know which entry in this array belongs to a certain gadget,
  663. GenGui generates a definition for every Gadget, which tells you which entry
  664. belongs to a certain gadget. The name of this definition has the form:
  665.  
  666. 'Projectname'_'GadgetID'
  667.  
  668. OK, let's have a simple example to illustrate, how you would use it. The
  669. second headerfile has the extension "_def.h" and contains only the structure
  670. definitions, the prototypes, the "extern" references and the #defines. It is
  671. useful if you want to access the GUI from another module.
  672.  
  673. This could be a description of a GUI:
  674.  
  675. #c_source
  676.  
  677. #define ExampleButton 1  // I want to have a more telling name than a number
  678.  
  679. #end_source
  680.  
  681. Projectname Test
  682. VBOX
  683.    BUTTON
  684.       TEXT "Test"
  685.       ID ExampleButton
  686.    end
  687. end
  688.  
  689. or which is equivalent:
  690.  
  691.  
  692. Projectname TEST
  693. VBOX
  694.    BUTTON
  695.       TEXT "Test"
  696.       ID ExampleButton=1
  697.    end
  698. end
  699.  
  700.  
  701. To render the GUI to the window you would use:
  702.  
  703.    RenderGui(window,&Test);
  704.  
  705. And to change the attributes of the gadget you would use:
  706.  
  707.    GG_SetGadgetAttrs(Test_Gadgets[Test_ExampleButton],window,NULL, ... );
  708.  
  709. Or for lowlevel changes:
  710.    GG_SetLowlevelAttrs(&Test_GadInfo_ExampleButton, .... );
  711.  
  712.  
  713. For the handling of gadgets, there are some useful macros in gengui.h,
  714. which is automatically included in the generated headerfiles:
  715.  
  716. GetGadget()    generates the address of the selected gadget from the
  717.                received IntuiMessage:
  718.  
  719.                struct Gadget *GetGadget(struct IntuiMessage *)
  720.  
  721.  
  722. GetInfo()      calculates the address of the GadInfo structure from the
  723.                address of the gadget.
  724.  
  725.                struct GadInfo *GetInfo(struct Gadget *)
  726.  
  727.  
  728. GetString()    takes the address of a string-gadget and retrieves a pointer
  729.                to the contents of the buffer.
  730.  
  731.                UBYTE *GetString(struct Gadget *)
  732.  
  733.  
  734. GetNumber()    retrieves the value stored in a number-gadget.
  735.  
  736.                LONG GetNumber(struct Gadget *)
  737.  
  738.  
  739. GetUserData(): Since Gengui needs the field "UserData" for internal use, it
  740.                reserves another field for this purpose, it generates a this
  741.                macro GetUserData() that fullfills the purpose of accessing
  742.                this field for userdata.
  743.  
  744.                ULONG GetUserData(struct Gadget *)
  745.  
  746.  
  747. For the handling of customgadgets you require some additional defines:
  748. First there are some "modes" defined, whose meaning is explained in the
  749. chapter for customgadgets.
  750.  
  751. The other structures in the headerfile contain the actual data that
  752. describes the GUI. Since they are not important for the programmer their
  753. names consist of the projectname and an extension of some numbers and
  754. characters.
  755.  
  756. If you want to know more of what can be found in the headerfile you should
  757. have a look at the generated source :).
  758.  
  759.  
  760. 6. Writing code using GenGui
  761. ============================
  762. The first thing you have to do is to write the file with the description of
  763. the GUI in the description-language, that was presented in chapter 2. The
  764. filename must have the extension .gui. The next step is to compile this
  765. description to a normal C-headerfile using GenGui:
  766.    GenGui  file.gui
  767.  
  768. You will get two headerfiles: file.h and file_def.h
  769. "file.h" contains the data of the GUI and "file_def.h" contains all from
  770. "file.h" except for the data itself.
  771.  
  772. There are two important aspects:
  773.  - You must use Gui_GetIMsg() instead of GT_GetIMsg()!
  774.  - You must use Gui_SetGadgetAttrs() instead of GT_SetGadgetAttrs()!
  775.  
  776. The following example will show you how to use these GUI's within your own
  777. programs:
  778.  
  779. #include "file.h"  // include the headerfile that was generated by GenGui
  780.  
  781. main()
  782. {
  783.    struct IntuiMessage *msg;
  784.    struct WIndow *win;
  785.    int run=1;
  786.  
  787.    /*
  788.  
  789.    . Now open all required libraries and the window. "win" must point to
  790.    . the newly opened window.
  791.  
  792.    */
  793.  
  794.    /* The Projectname of the GUI is TestPro */
  795.  
  796.    if(GG_RenderGui(win,&TestPro)) {/* do the cleanup, send an error msg .... */}
  797.             /* GG_RenderGui returns 0 if successful, an error code on failure */
  798.  
  799.    while(run) {
  800.       WaitPort(win->UserPort);  // you may use Wait instead, if you like :)
  801.  
  802.       while(msg=GG_GetIMsg(win->UserPort)) {
  803.             /* It is very important that you use this function instead of
  804.                GetMsg or GT_GetIMsg(), since it does some additional
  805.                actions !!! */
  806.  
  807.          switch(msg->Class) {
  808.             case IDCMP_CLOSEWINDOW: run=0;break;
  809.             case IDCMP_NEWSIZE:     GG_ResizeGui(&TestPro); // do the resizing
  810.                                     break;
  811.             case IDCMP_REFRESHWINDOW:
  812.                                     GG_BeginRefresh(&TestPro);
  813.                                     GG_RefreshGui(&TestPro); // and the refresh
  814.                                     GG_EndRefresh(&TestPro,TRUE);
  815.                                     break;
  816.             // ... and some more actions you need
  817.          }
  818.          GG_ReplyIMsg(msg);
  819.       }
  820.    }
  821.  
  822.    GG_FreeGui(&TestPro); // Free the gadgets
  823.  
  824.    /* close the window and free the sources etc. */
  825. }
  826.  
  827. When opening the window you should consider that it must be large enough to
  828. have room for all gadgets. If the window is too small then the GUI will look
  829. quite messed up. You can determine the minimal required size with the
  830. GG_MinSize function, at least when the MIN-sizes are correctly set. Or you
  831. can use GG_SmartRenderGui, which takes care of the needed size and moves or
  832. resizes the window due to these requirements. It even substitutes the font
  833. used in the window by a smaller one, if required.
  834.  
  835.  
  836. 5. Hook functions
  837. =================
  838. For every gadget you may define a hook-function. This function is called
  839. whenever Intuition sends a message for this gadget. It receives the address
  840. of the Intuimessage as parameter and must return an int as result. If you
  841. return null then the Intuimessage is passed on to your main program, in the
  842. other case the Intuimessage is ignored and your program will not receive
  843. this message any more:
  844.  
  845. int __stdargs HookFunction(struct IntuiMessage *msg)
  846. {
  847.    int ignore=1; /* The IntuiMessage will not be passed on to the program */
  848.  
  849.  
  850.    /* do some actions */
  851.  
  852.    return ignore;
  853. }
  854.  
  855.  
  856. 7. Custom gadgets
  857. =================
  858. Custom gadgets are a very powerful element for generating graphical user
  859. interfaces. They not only allow you to add gadgets other than gadtools
  860. gadgets, you can also use it to render information to the window, that is
  861. not really a gadget, for example some borders or texts, which should
  862. be resizeable. And a special thing which you can create using customgadgets
  863. are multiplexed user interfaces. "What's that?", you may ask. OK, I'll give
  864. you an idea, what you can achieve by this. Imagine that there is not enough
  865. room in the window to place all gadgets in it. Then you could have e.g. a
  866. cyclegadget with which you can select the group of gadgets you want to
  867. be visible in the window.
  868. First at all every customgadget requires a function that handles the
  869. creation of the "gadget". This function gets 7 arguments, the first one is
  870. a pointer to a WinInfo structure, the second one is a pointer to a NewGadget
  871. structure which was filled with all needed data (only MODE_NEW,MODE_RESIZE
  872. and MODE_REFRESH). The third one is a pointer to a GadInfo and the last
  873. four parameters describe the position and the width/height of the area of
  874. gadget.
  875. NOTE: The area of the gadget also contains the spacing around the gadget.
  876.       The (suggested) dimensions of the gadget itself can be found in the
  877.       newgadget structure.
  878.  
  879. This function is called in several cases. It is not only called when the
  880. gadget should be created, but also when it should be removed. There are
  881. 6 Modes, which are marked in 'Mode' field of the WinInfo structure.
  882. The Modes are:
  883.  
  884. GG_MODE_NEW:     A new gadget should be created. If you create gadgets you
  885.                  should add them to the GList 'Gadgets' in the WinInfo
  886.                  structure and fill 'Prev' in the same structure with the
  887.                  pointer to the last gadget.
  888.  
  889. GG_MODE_RESIZE:  The gadget should be resized. You must not use
  890.                  GT_SetGadgetAttrs() to change the state of gadtools gadgets,
  891.                  since during the GG_MODE_RESIZE call the gadgets are not
  892.                  bound to any window and GG_SetGadgetAttrs() would not work
  893.                  at this point, but you might use GG_SetLowlevelAttrs().
  894.  
  895. GG_MODE_REFRESH: Redraw the gadget. You need not redraw system-gadgets, since
  896.                  RefreshGList() is called internally.
  897.  
  898. GG_MODE_FREE:    Free the gadget and delete all stored contents
  899.  
  900. GG_MODE_STOP:    Delete the gadget, but keep the contents, that were stored
  901.                  by GG_MODE_BACKUP.
  902.  
  903. GG_MODE_BACKUP:  Store the complete information of the gadget e.g. if the
  904.                  gadget is disabled and the selection-state. You may store
  905.                  that information in the Code field of the delivered GadInfo
  906.                  structure and the information if it is disabled can be
  907.                  stored using the flag GG_FLAG_DISABLED in 'dim.Flags' of
  908.                  this structure. You must not change any other bits in this
  909.                  field.
  910.  
  911. GG_MODE_RESTORE: Restore the information that was stored with GG_MODE_BACKUP.
  912.  
  913.  
  914. If you just want to draw some lines, you should ignore the latter three
  915. cases that are only important for the handling of gadgets or 'SubGui's. In
  916. these cases the contents of the NewGadget structure are not valid, however
  917. you will get a pointer to such a structure to avoid enforcer-hits.
  918. You can also use the field Render in the WinInfo structure to determine if
  919. you have draw your lines. It is set to 1 if drawing is needed and to 0 if
  920. not.
  921.  
  922. You must return 0 if everything was OK and any value !=0 if an error
  923. occurred.
  924.  
  925. If you want to draw some lines and render another GUI in this area you can
  926. use "SubGuis". Therefore you must describe a complete GUI just like before
  927. and render this GUI with GG_SubGui() to the window. This function takes the
  928. same parameters as RenderGui() plus four additional parameters which
  929. describe the position and the dimensions of the GUI. You must call this
  930. every time your customfunction is called. This function returns 0 on success
  931. and a value !=0 if an error occurred. In this case your function must
  932. also return a value !=0 to tell that there was an error.
  933. There is another thing that is possible using 'SubGuis', that are
  934. multiplexed user-interfaces. You might have several groups of gadgets that
  935. are rendered to the same place in the window and e.g. a global variable
  936. decides which of these groups is displayed in the window. Note that you must
  937. remove the complete GUI from the window first, if you want to switch the
  938. groups, but you cannot use FreeGui(), since this would lose the complete
  939. information that is stored in the GUI. StopGui() exists for this case. It
  940. stores this information and removes the GUI after this. The next time you
  941. call RenderGUI this information is restored. StopGUI() can also be used
  942. if you want to keep informations although you want to close the window,
  943. because you might reopen it later. See also the example for multiplexed
  944. interfaces.
  945.  
  946.  
  947. 8. The functions in the runtime-library "gengui_lnk.o"
  948. ======================================================
  949.  
  950. GG_BeginRefresh:
  951.  
  952.    void GG_BeginRefresh(struct WinInfo *winfo)
  953.  
  954.    Invokes the intuition.library/BeginRefresh() function in a manner
  955.    friendly to the gengui toolkit.  This function call permits the
  956.    gadgets to refresh themselves at the correct time and restricts
  957.    rendering to the damaged regions that need refresh.
  958.    Call GT_EndRefresh() function when done.
  959.  
  960.    NOTE:
  961.  
  962.       The nature of GadTools precludes the use of the IDCMP flag
  963.       WFLG_NOCAREREFRESH.  You must handle IDCMP_REFRESHWINDOW events
  964.       in at least the minimal way, namely:
  965.  
  966.  
  967.       case IDCMP_REFRESHWINDOW:
  968.             GG_BeginRefresh(wininfo);
  969.             GG_EndRefresh(wininfo, TRUE);
  970.             break;
  971.  
  972.    Normally you would use:
  973.  
  974.       case IDCMP_REFRESHWINDOW:
  975.             GG_BeginRefresh(&Project);
  976.             GG_RefreshGui(&Project);
  977.             GG_EndRefresh(&Project, TRUE);
  978.             break;
  979.  
  980.  
  981.  
  982. GG_BeginResizeGui:
  983.  
  984.    void GG_BeginResizeGui(struct WinInfo *winfo)
  985.  
  986.    You can use this function to speed up the process of resizing the GUI.
  987.    Therefore you have to use IDCMP_SIZEVERIFY, which signals your program,
  988.    that the user wants to resize the GUI. If you call GG_BeginResizeGui,
  989.    when this happens, all gadgets are detached from the window and intuition
  990.    does no refresh on these gadgets, which would be useless anyways, since
  991.    the GUI is refreshed after it has been resized. But note, you really
  992.    should know, that if you don't handle this message immediately, you may
  993.    get a deadlock of your system. Therefore don't use IDCMP_SIZEVERIFY if
  994.    you are not sure about the side-effects of switching on this
  995.    message-type. It's probably better to have a slightly slower program,
  996.    than a buggy program.
  997.  
  998.  
  999. GG_ClearWindow:
  1000.  
  1001.    void GG_ClearWindow(struct Window *)
  1002.  
  1003.    Removes all contents from the window, erases the inner of the window
  1004.    with the EraseRect() and refreshes the windowborders.
  1005.  
  1006.  
  1007. GG_EndRefresh:
  1008.  
  1009.    void GG_EndRefresh(struct WinInfo *winfo, BOOL complete)
  1010.  
  1011.    Invokes the intuition.library/EndRefresh() function in a manner
  1012.    friendly to the gengui toolkit.  This function call permits the
  1013.    gadgets to refresh themselves at the correct time and restricts
  1014.    rendering to the damaged regions that need refresh.
  1015.    Call this function when you have used GG_BeginRefresh()
  1016.  
  1017.  
  1018. GG_FreeGui:
  1019.  
  1020.    void  GG_FreeGui(struct WinInfo *winfo)
  1021.  
  1022.    GG_FreeGui removes the gadgets from the window. It is save to call this
  1023.    functions for already freed GUIs.
  1024.  
  1025.  
  1026. GG_GetIMsg:
  1027.  
  1028.    struct IntuiMessage *GG_GetIMsg(struct MsgPort *)
  1029.  
  1030.    You must call this function instead of GT_GetIMsg() or GetMsg().
  1031.    It returns a pointer to an IntuiMessage, if there is a message of
  1032.    interest for the program, otherwise it returns NULL. This is for example
  1033.    the case if you have a hook-function seleced for a gadget which returns a
  1034.    value !=0 to indicate that the message may be ignored.
  1035.  
  1036.  
  1037. GG_GfxPrint:
  1038.  
  1039.    void GG_GfxPrint(struct RastPort *rast,char *text,int left,int top);
  1040.  
  1041.    This function is used to format and print a text to a RastPort.
  1042.    The following format-specifiers are supported:
  1043.  
  1044.                   \n  : Newline: the next character is printed at the start
  1045.                                  of the next line.
  1046.                   %%  : '%'
  1047.  
  1048.                   %Cx : Set foreground color to x
  1049.                         (e.g. %C1 : set color to 1)
  1050.                   %cx : Set background color to x
  1051.  
  1052.                   %B  : Bold on
  1053.                   %b  : Bold off
  1054.                   %I  : Italics on
  1055.                   %i  : Italics off
  1056.                   %N  : Normal style (Bold,Italics,Underlined off)
  1057.                   %U  : Underlined on
  1058.                   %u  : Underlined off
  1059.  
  1060.    Parameters:
  1061.             rast     : Pointer to your RastPort
  1062.             text     : A pointer to your textstring
  1063.             left,top : Left, top corner of the textblock
  1064.  
  1065.  
  1066. GG_GfxPrintSize:
  1067.  
  1068.    void GG_GfxPrintSize(struct RastPort *rast,char *text,struct TextSize *size);
  1069.  
  1070.    This function is used to calculate the width and height a text
  1071.    would occupy when printed with GG_GfxPrint().
  1072.  
  1073.  
  1074.    Parameters:
  1075.             rast     : Pointer to your RastPort
  1076.             text     : A pointer to your textstring
  1077.  
  1078.             size     : A pointer to the struct, in which the result will
  1079.                        be stored.
  1080.  
  1081.  
  1082. GG_MinSize:
  1083.  
  1084.    void GG_MinSize(struct Window *win, struct WinInfo *gui,
  1085.                    struct GG_ObjectSize *size);
  1086.  
  1087.    GG_MinSize calculates the minimal size for the window win, such that
  1088.    the gui will fit within this window. The result is written to 'size',
  1089.    which must point to some valid memory-position. This size does not cover
  1090.    any bordersizes of the window, these must be added to the calculated
  1091.    sizes.
  1092.  
  1093.  
  1094. GG_MinSize:
  1095.  
  1096.    void GG_MinSizeFont(struct TextFont *font, struct WinInfo *gui,
  1097.                        struct GG_ObjectSize *size);
  1098.  
  1099.    GG_MinSizeFont calculates the minimal size for the font 'font', such that
  1100.    the gui will fit within window of this (inner) size. The result is
  1101.    written to 'size', which must point to some valid memory-position.
  1102.    This size does not cover any bordersizes of the window. Therefore
  1103.    it would be suitable for opening a window with WA_InnerWidth and
  1104.    WA_InnerHeight.
  1105.  
  1106.  
  1107. GG_RefreshGui:
  1108.  
  1109.    int GG_RefreshGui(struct WinInfo *winfo)
  1110.  
  1111.    This function is used to refresh the gadgets within the window.
  1112.    It is only important if you are using SimpleRefresh, since only then it
  1113.    is your job to refresh the window. If you are using SmartRefresh windows
  1114.    then it should not be required since the system does that job for you.
  1115.    It returns 0 if everything was OK.
  1116.  
  1117.  
  1118. GG_RenderGui:
  1119.  
  1120.    int GG_RenderGui(struct Window *win, struct WinInfo *winfo)
  1121.  
  1122.    GG_RenderGui draws the gadgets to the window. You must supply the pointer
  1123.    to the window and the pointer to the WinInfo structure of your GUI.
  1124.    This one can be obtained by using the & operator on the name that was
  1125.    selected using "PROJECTNAME" in the descriptionfile.
  1126.    It returns 0 if everything was OK.
  1127.  
  1128.  
  1129. GG_ResizeGui:
  1130.  
  1131.    int GG_ResizeGui(struct WinInfo *winfo)
  1132.  
  1133.    This function is used to adapt the GUI to the new size when a window
  1134.    has been resized. You must call this function every time you receive
  1135.    a IDCMP_NEWSIZE message.
  1136.    It returns 0 if everything was OK.
  1137.    You can speed up the resizing-process by using GG_BeginResizeGui.
  1138.  
  1139.  
  1140. GG_SetGadgetAttrs / GG_SetGadgetAttrsA:
  1141.  
  1142.    BOOL GG_SetGadgetAttrsA(struct Gadget *, struct Window *,
  1143.                            struct Requester *, struct TagItem *)
  1144.  
  1145.    BOOL GG_SetGadgetAttrs(struct Gadget *, struct Window *,
  1146.                            struct Requester *, Tag, ...)
  1147.  
  1148.  
  1149.    This is a replacemet for the function GT_SetGadgetAttrs of
  1150.    gadtools.library. You must call this function instead of that of gadtools,
  1151.    since Gengui needs to keep track of the information stored in the gadgets.
  1152.    NOTE: Whereas the gadtools function returns VOID this one returns if it
  1153.          was successful to modify the attributes. If there is not enough
  1154.          memory it returns 0 to indicate that there was an error and the
  1155.          attributes are not changed.
  1156.  
  1157.  
  1158. GG_SetLowlevelAttrs / GG_SetLowlevelAttrsA:
  1159.  
  1160.    BOOL GG_SetLowlevelAttrsA(struct GadInfo *, struct TagItem *)
  1161.  
  1162.    BOOL GG_SetLowlevelAttrs(struct GadInfo *, Tag, ...)
  1163.  
  1164.    Whereas the GG_SetAttrs function cannot be used, as long as the
  1165.    GUI is not rendered to a window, and cannot be used for changing tags,
  1166.    that cannot be changed as long as Gadgets are rendered to a window,
  1167.    e.g. the depth of a palette-gadget, these functions can do this magic
  1168.    thing. If the GUI is already rendered to a window, you must call
  1169.    GG_ResizeGui after this function, to make these changes take effect.
  1170.    GG_ResizeGui removes and recreates all gadgets and this allows to
  1171.    change really all tags.
  1172.  
  1173.  
  1174. GG_SmartRenderGui:
  1175.  
  1176.    int  GG_SmartRenderGui(struct Window *win, struct WinInfo *winfo,
  1177.                           struct TextFont **font)
  1178.  
  1179.    GG_SmartRenderGui determines the minimum size of the GUI and adjusts the
  1180.    window according to this information. Therefore it may resize and move
  1181.    the window and if this is not sufficient, it will switch to another font.
  1182.    Therefore you must call it with a pointer to a pointer to a font.
  1183.    If this pointer is a nullpointer, then it will open the topaz 80 font,
  1184.    in the other case it will use the delivered font as a fall-back font.
  1185.    It is up to you to close this font, when your program exits. If the GUI
  1186.    would not fit within the window, although it already uses the fall-back-
  1187.    font, it ignores that and the display might look messed up, but that's
  1188.    probably better, than not being able to display anything at all,
  1189.    since the user then really has no chance to use the program.
  1190.  
  1191.    GG_SmartRenderGui draws the gadgets to the window. You must supply the
  1192.    pointer to the window and the pointer to the WinInfo structure of your
  1193.    GUI. This one can be obtained by using the & operator on the name that
  1194.    was selected using "PROJECTNAME" in the descriptionfile.
  1195.    It returns 0 if everything was OK.
  1196.  
  1197.  
  1198.    Input:
  1199.             win:   Pointer to an open Window
  1200.             winfo: Pointer to your GUI, You can obtain this pointer
  1201.                    by using the & operator on the name, you have given
  1202.                    for PROJECTNAME in the descriptionfile
  1203.             font:  Pointer to an pointer to an fall-back-font or to a
  1204.                    NULL-pointer.
  1205.  
  1206.  
  1207.    Result: 0 if everything was OK
  1208.  
  1209.  
  1210.    Example:
  1211.  
  1212.       struct TextFont *font=NULL;
  1213.  
  1214.  
  1215.       ...
  1216.  
  1217.       /* Open your window */
  1218.  
  1219.  
  1220.  
  1221.       if(GG_SmartRenderGui(win,&Gui,&font)) {
  1222.  
  1223.          /* failed */
  1224.  
  1225.          CloseWindow(win);
  1226.          if(font) CloseFont(font);
  1227.  
  1228.          /* additional error-handling */
  1229.       }
  1230.  
  1231.  
  1232.  
  1233.       ... /* Your code goes here */
  1234.  
  1235.       CloseWindow(win)
  1236.       if(font) CloseFont(font); /* you must not close it, as long as
  1237.                                    the window stays open, since it will be
  1238.                                    uses as long as this window exists */
  1239.  
  1240.  
  1241.  
  1242.    Notes:
  1243.       - If you call it with your own fall-back font, that was obtained by
  1244.         OpenDiskFont, you must call CloseDiskFont instead of CloseFont.
  1245.  
  1246.       - The fall-back font should definitely be smaller than the default-font,
  1247.  
  1248.  
  1249. GG_StopGui:
  1250.  
  1251.    void GG_StopGui(struct WinInfo *winfo)
  1252.  
  1253.    GG_StopGui() stores the information of the gadgets and removes them after
  1254.    this from the window. GG_RenderGui() will recognize if the information was
  1255.    stored and will restore them if this was the case.
  1256.  
  1257.  
  1258. GG_SubGui:
  1259.  
  1260.    int GG_SubGui(struct WinInfo *parent, struct WinInfo *winfo,
  1261.               int left,int top,int width, int height)
  1262.  
  1263.    GG_SubGui allows to draw GUIs within another GUI. You must not use this
  1264.    function for other purposes. It is not possible to render a GUI only
  1265.    with this function. You must use GG_RenderGui() for this, since it
  1266.    allocates some additional resources wich are also required by GG_SubGui
  1267.    and must be already allocated when GG_SubGui is called.
  1268.  
  1269.  
  1270.  
  1271. MACROS:
  1272. ======
  1273.  
  1274. GetString:
  1275.  
  1276.    UBYTE * GetString(struct Gadget *)
  1277.  
  1278.    This macro returns a pointer to the contents of a string-gadget if passed
  1279.    a pointer to the string-gadget.
  1280.  
  1281.  
  1282. GetNumber:
  1283.  
  1284.    LONG GetNumber(struct Gadget *)
  1285.  
  1286.    This macro returns the contents of a integer-gadget if passed
  1287.    a pointer to the integer-gadget.
  1288.  
  1289.  
  1290. GetInfo:
  1291.  
  1292.    struct GadInfo * GetInfo(struct Gadget *)
  1293.  
  1294.    This macro returns a pointer to the correlated GadInfo structure of a
  1295.    given gadget.
  1296.  
  1297.  
  1298. GetUserData:
  1299.  
  1300.    ULONG GetUserData(struct Gadget *)
  1301.  
  1302.    This macro returns a the userdata of the given gadget.
  1303.  
  1304.    NOTE: You cannot use the udserdata-field of gadtools gadgets, since
  1305.          this field is required by the gengui link-library for internal use.
  1306.  
  1307.  
  1308. GetGadget:
  1309.  
  1310.    struct Gadget * GetGadget(struct IntuiMessage *)
  1311.  
  1312.    This macro calculates the address of the gadget in an intuimessage
  1313.    of the type IDCMP_GADGETUP or IDCMP_GADGETDOWN
  1314.  
  1315.  
  1316. 9. Compiling
  1317. ============
  1318.  
  1319. You need to compile gengui_lnk.c in the Gui_lib directory and link this to
  1320. your program. Of course you need not recompile it every time. Just compile
  1321. it with your favourite C-compiler and then link gengui_lnk.o to your program.
  1322. If you are using SAS-C, then you can use the already compiled module in this
  1323. directory.
  1324.  
  1325.  
  1326. 10. What's new
  1327. =============
  1328.  
  1329. Version 2.1:
  1330.  
  1331.    There is now support for easy reserving space aroung objects, that is
  1332.    required for e.g. the texts of gadgets. (Till version 2.0 you had to
  1333.    reserve it via empty boxes.)
  1334.  
  1335.  
  1336.    Previous versions did not support BeginRefresh and EndRefresh, this
  1337.    caused a slowdown of the refresh and of scrolling in the window.
  1338.    Now there are GG_BeginRefresh() and GG_EndRefresh(). These clean up
  1339.    the damage-list of the window and reduce the rendering of the refresh
  1340.    to the damaged regions and therefore speed up the refresh.
  1341.  
  1342. Version 2.0:
  1343.  
  1344.    GenGui has some additional capabilities for designing GUI's. There are:
  1345.  
  1346.    - frames
  1347.    - bars
  1348.    - graphical buttons
  1349.    - formatted texts
  1350.    - backgound patterns
  1351.  
  1352.    Furthermore GenGui is now able to determine the minimum size of the window
  1353.    the GUI should be rendered to. Therefore there is a new set of commands
  1354.    for the description language, to determine the minimum size for boxes or
  1355.    gadgets with relative size. The user is supported by a quite complex
  1356.    default-mechanism, so that he need not give any information in most cases.
  1357.  
  1358.  
  1359.    Then I have cleaned up the names of the interface for gengui. But don't
  1360.    panic, if you define GG_OLDSTYLE you will get the old names for
  1361.    compatibility reasons.
  1362.  
  1363.    NOTE: It is not possible just to link with the new link-library, you have
  1364.          also to recompile the GUI-description with the new gengui, but that
  1365.          shouldn't be a problem.
  1366.  
  1367.    NOTE2: You should not use Gui_GetIMsg any more, which internally replies
  1368.          the Intuimessage, since this could mess up multi-selections of menus.
  1369.          Instead you should use GG_GetIMsg() and GG_ReplyMsg().
  1370.  
  1371.  
  1372. 11. Credits
  1373. ===========
  1374.  
  1375. Thanks to all who have sent me bug-reports and / or suggestions for
  1376. improvements of this tool.
  1377.  
  1378.  
  1379.